package com.lenovo.lcdm.dcm.enums;

/**
 * @Auther xujing30
 * @Date 2024/01/22
 * @Description
 */
public enum ConfigurationTypeEnum {
    KEYWORDS("keywords", "Keywords Mapping File", "KEYWORDS MAPPING", "DcmBusinessConfigurationKeywords", "business"),
    CATEGORY_C("categoryCharacteristic", "Category-Characteristic Mapping File", "CATEGORY CHARACTERISTIC MAPPING", "DcmBusinessConfigurationCategoryC", "business"),

    GEO_MAPPING("geoMapping", "DCM_System Config File", "DCM_GROUP_GEO", "DcmSystemConfigurationGeoMapping", "system"),

    GEO_COUNTRY_MAPPING("geoCountryMapping", "Suffix Config File", "SuffixFullList,GEOSuffix", "DcmSystemConfigurationGeoMapping", "business");

    private String fileName;

    private String sheetName;
    private String className;
    private String type;

    /**
     * 业务配置或系统配置
     */
    private String businessOrSys;

    ConfigurationTypeEnum(String type, String fileName, String sheetName, String className, String businessOrSys) {
        this.type = type;
        this.fileName = fileName;
        this.sheetName = sheetName;
        this.className = className;
        this.businessOrSys = businessOrSys;
    }

    public String getFileName() {
        return fileName;
    }

    public String getSheetName() {
        return sheetName;
    }

    public String getClassName() {
        return className;
    }

    public String getType() {
        return type;
    }

    public static String getClassNameByType(String type) {
        if (ConfigurationTypeEnum.KEYWORDS.type.equals(type)) {
            return ConfigurationTypeEnum.KEYWORDS.className;
        } else if (ConfigurationTypeEnum.CATEGORY_C.type.equals(type)) {
            return ConfigurationTypeEnum.CATEGORY_C.className;
        } else if (ConfigurationTypeEnum.GEO_MAPPING.type.equals(type)) {
            return ConfigurationTypeEnum.GEO_MAPPING.className;
        } else if (ConfigurationTypeEnum.GEO_COUNTRY_MAPPING.type.equals(type)) {
            return ConfigurationTypeEnum.GEO_COUNTRY_MAPPING.className;
        } else {
            return null;
        }
    }

    public static String getSheetNameByType(String type) {
        if (ConfigurationTypeEnum.KEYWORDS.type.equals(type)) {
            return ConfigurationTypeEnum.KEYWORDS.sheetName;
        } else if (ConfigurationTypeEnum.CATEGORY_C.type.equals(type)) {
            return ConfigurationTypeEnum.CATEGORY_C.sheetName;
        } else {
            return null;
        }
    }

    public static String getFileNameByType(String type) {
        if (ConfigurationTypeEnum.KEYWORDS.type.equals(type)) {
            return ConfigurationTypeEnum.KEYWORDS.fileName;
        } else if (ConfigurationTypeEnum.CATEGORY_C.type.equals(type)) {
            return ConfigurationTypeEnum.CATEGORY_C.fileName;
        } else if (ConfigurationTypeEnum.GEO_MAPPING.type.equals(type)) {
            return ConfigurationTypeEnum.GEO_MAPPING.fileName;
        } else if (ConfigurationTypeEnum.GEO_COUNTRY_MAPPING.type.equals(type)) {
            return ConfigurationTypeEnum.GEO_COUNTRY_MAPPING.fileName;
        } else {
            return null;
        }
    }

    public static String getTypeByFileName(String fileName) {
        if (ConfigurationTypeEnum.KEYWORDS.fileName.equals(fileName)) {
            return ConfigurationTypeEnum.KEYWORDS.type;
        } else if (ConfigurationTypeEnum.CATEGORY_C.fileName.equals(fileName)) {
            return ConfigurationTypeEnum.CATEGORY_C.type;
        } else if (ConfigurationTypeEnum.GEO_MAPPING.fileName.equals(fileName)) {
            return ConfigurationTypeEnum.GEO_MAPPING.type;
        } else if (ConfigurationTypeEnum.GEO_COUNTRY_MAPPING.fileName.equals(fileName)) {
            return ConfigurationTypeEnum.GEO_COUNTRY_MAPPING.type;
        }else {
            return null;
        }
    }

    public static String getClassNameByFileName(String fileName) {
        if (ConfigurationTypeEnum.KEYWORDS.fileName.equals(fileName)) {
            return ConfigurationTypeEnum.KEYWORDS.className;
        } else if (ConfigurationTypeEnum.CATEGORY_C.fileName.equals(fileName)) {
            return ConfigurationTypeEnum.CATEGORY_C.className;
        } else if (ConfigurationTypeEnum.GEO_MAPPING.fileName.equals(fileName)) {
            return ConfigurationTypeEnum.GEO_MAPPING.className;
        } else if (ConfigurationTypeEnum.GEO_COUNTRY_MAPPING.fileName.equals(fileName)) {
            return ConfigurationTypeEnum.GEO_COUNTRY_MAPPING.className;
        } else {
            return null;
        }
    }

    public static String getBusinessOrSysByType(String type) {
        if (ConfigurationTypeEnum.KEYWORDS.type.equals(type)) {
            return ConfigurationTypeEnum.KEYWORDS.businessOrSys;
        } else if (ConfigurationTypeEnum.CATEGORY_C.type.equals(type)) {
            return ConfigurationTypeEnum.CATEGORY_C.businessOrSys;
        } else if (ConfigurationTypeEnum.GEO_MAPPING.type.equals(type)) {
            return ConfigurationTypeEnum.GEO_MAPPING.businessOrSys;
        } else if (ConfigurationTypeEnum.GEO_COUNTRY_MAPPING.type.equals(type)) {
            return ConfigurationTypeEnum.GEO_COUNTRY_MAPPING.businessOrSys;
        } else {
            return null;
        }
    }
}
